class Pet:
    def __init__(self, name, age, variety, color):  # 重写构造方法
        self.name = name
        self.age = age
        self.variety = variety
        self.color = color

    def eat(self):  # 定义eat方法
        print("宠物要吃东西！")

    def bark(self):  # 定义bark方法
        print("宠物会叫唤！")

    def __str__(self):  # 重写__str__方法
        return '名字：{0}，年龄：{1}岁，品种：{2}，品种：{3}'.format(self.name, self.age, self.variety, self.color)


class Dog(Pet):
    def eat(self):  # 重写eat方法
        print(self.name + '吃骨头')

    def bark(self):  # 重写bark方法
        print(self.name + '汪汪叫')

    def guardHose(self):  # 定义guardHose方法
        print(self.name + '看家护院')


class Cat(Pet):
    def __init__(self, name, age, variety, color, sex):  # 重写构造方法
        super(Cat, self).__init__(name, age, variety, color)
        self.sex = sex

    def eat(self):  # 重写eat方法
        print(self.name + '喜欢吃鱼')

    def bark(self):  # 重写bark方法
        print(self.name + '会喵喵叫')

    def catchMice(self):  # 定义catchMice方法
        print(self.name + '会抓老鼠')

    def __str__(self):  # 重写__str__方法
        str = super(Cat, self).__str__()
        str += ',性别:{0}'.format(self.sex)
        return str


class PetShop:
    def __init__(self, store_name, *pet_list):  # 重写构造方法
        self.store_name = store_name
        self.pet_list = pet_list

    def showPets(self):  # 定义打印宠物列表的方法
        if len(self.pet_list) == 0:
            print(self.store_name + '暂无宠物')
            return
        print('{0}有{1}个宠物，他们是：'.format(self.store_name, len(self.pet_list)))
        for pet in self.pet_list:  # 将宠物列表元素循环打印输出
            print(pet)


dog1 = Dog('旺财', 3, '金毛', '黄色')
dog1.eat()
dog1.bark()
dog1.guardHose()
print("----------------------------")
cat1 = Cat('嘟嘟', 2, '咖啡', '灰色', '男')
cat1.eat()
cat1.bark()
cat1.catchMice()
print("----------------------------")
dog2 = Dog('黑贝', 3, '牧羊犬', '黑色')
cat2 = Cat('糖果', 3, '布偶', '白色', '女')
petshop = PetShop('乐派宠物店', dog1, dog2, cat1, cat2)
petshop.showPets()
